## 查询为主，用字典
## 164ms 18352KB 10MIn
num=int(input())
grades={str(i):0 for i in range(101)}
score=[i for i in input().split()]
check=[i for i in input().split()][1:]

for i in score:
    grades[i]+=1

ans=[grades[k] for k in check]
print(*ans)

# 167ms 18864KB 5Min
# from collections import Counter
# input()
# score=[i for i in input().split()]
# grades=Counter(score)
# check=[i for i in input().split()][1:]
# ans=[grades[k] for k in check]

# print(*ans)